/*
 * @Author: 颜礼田 2564217790@qq.com
 * @Date: 2024-09-06 18:22:28
 * @LastEditors: 颜礼田 2564217790@qq.com
 * @LastEditTime: 2024-09-09 09:07:50
 * @FilePath: /webServer/src/configuration.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Configuration, App } from '@midwayjs/core';
import { join } from 'path';
import * as koa from '@midwayjs/koa';
import { components, useChecked } from './plugins';
import { filters } from './filter';
import { middlewares } from './middleware';

@Configuration({
  imports: [koa, ...components],
  importConfigs: [join(__dirname, './config')],
})
export class MainConfiguration {
  @App('koa')
  app: koa.Application;

  async onReady() {
    useChecked(this.app);
    // add middleware
    this.app.useMiddleware(middlewares);
    // add filter
    this.app.useFilter(filters);
  }
}
